<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=request.getServletContext().getContextPath()%></title>
<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/js/jqGrid/css/ui.jqgrid.css"></link>
<script src="<%=request.getContextPath()%>/js/jqGrid/js/i18n/grid.locale-en.js"></script>
<script src="<%=request.getContextPath()%>/js/jqGrid/js/jquery.jqGrid.min.js"></script>
<style>
.ui-widget-content-altclass{
background-color: gray;
}
.ui-widget-content-altclass2{
background-color: gray;
}
</style>
<script>
/* $(function(){
	alert("qqqqqqqq");
}); */

function listadmin(){
	<%--  $.ajax({
			url:"<%=request.getContextPath() %>/service/admin/adminInfolist",
			type:"post",
			dataType: 'json',
			data:{id:"id123"},
			success:function(data) {
				alert("succ");
				alert(data.toString());
			}
		});  --%>
			jQuery("#projectGrid").jqGrid({
				url:"<%=request.getContextPath()%>/service/admin/adminInfolist",
				datatype: "json",
				mtype : 'post',
				rowNum: 20,
				pager: '#projectPaper',
				height : "auto",
				autowidth : true,
				regional : 'cn',
				altRows:true,//隔行变色
				altclass:'ui-widget-content-altclass',//隔行变色样式
				viewrecords : true,
				multiselect:false,
				jsonReader : {
					root : "result",
					page : "page",
					total : "total",
					records : "record",
					repeatitems : false
				},
				postData : {
					id:"1"
				},
				colNames : [
				            "ID",
				            "账号",
				            "密码"
				            ],
				colModel:[
				          {name:'adminId',index:'adminId'},
				          {name:'adminCode',index:'adminCode'},
				          {name:'adminPwd',index:'adminPwd'}
				         ] 
			});
		
}

function listCust(){
			jQuery("#projectGrid2").jqGrid({
				url:"<%=request.getContextPath()%>/service/cust/custInfolist",
				datatype: "json",
				mtype : 'post',
				rowNum: 20,
				pager: '#projectPaper2',
				height : "auto",
				autowidth : true,
				regional : 'cn',
				altRows:true,//隔行变色
				altclass:'ui-widget-content-altclass2',//隔行变色样式
				viewrecords : true,
				multiselect:false,
				jsonReader : {
					root : "result",
					page : "page",
					total : "total",
					records : "record",
					repeatitems : false
				},
				postData : {
					id:"1"
				},
				colNames : [
				            "客户ID",
				            "客户编号",
				            "客户姓名",
				            "查看"
				            ],
				colModel:[
				          {name:'fcustId',index:'fcustId'},
				          {name:'fcustNumber',index:'fcustNumber'},
				          {name:'fcustName',index:'fcustName'},
				          {name:'fcustId',index:'fcustId', sortable:false,formatter:function(cellvalue, options, rowObject ){
			        		  var html =  '<a href="javascript:void(0);" onclick=custinfo("'+cellvalue+'");>查看</a>';
			        		  return html;
				          }}
				         ] 
			});
}

function custinfo(fcustId){
	url="<%=request.getContextPath()%>/service/cust/custInfo?fcustId="+fcustId;
	window.location.href=url;
	
}
</script>
</head>
<body>
	ad
	<input type="text" readonly="readonly" value="${admin.adminPwd }" />
	<div>
		<a href="javascript:void(0)"><img
			src="${pageContext.request.contextPath}/images/img1.jpg" alt="11" /></a>
	</div>
	<br />11
	<input type="button" value="点击" onclick="listadmin()" />
	<br />
	<div id="projectTable" style="width: 480px;">
		<table id="projectGrid" class="jqGridTable" ></table>
		<div id="projectPaper"></div>
	</div>
	<input type="button" value="客户信息" onclick="listCust()" />
	<div id="projectTable2" style="width: 660px;">
		<table id="projectGrid2" class="jqGridTable" ></table>
		<div id="projectPaper2"></div>
	</div>
</body>
</html>
